package com.ks.core.properties;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * 项目相关配置
 *
 * @author kingdee
 * @date 2017年10月23日16:44:15
 */
@Data
@Configuration
@Component
@ConfigurationProperties(prefix = YuhongProperties.REST_PREFIX)
public class YuhongProperties {

    public static final String REST_PREFIX = "yuhong";

    private boolean authOpen = true;

    private boolean signOpen = true;

    private String host;

    private String pcHost;

    private String ip;

    private String appId;

    private String appSecret;

    private String solrHost;

    private String oldServer;

    @Value("${spring.profiles:pro}")
    private String profiles;

    /**
     * 求助站发表审核标识，true：审核，false：不审核
     */
    private boolean postCommentFlag;

    /**
     * 商城评论审核标识，true：审核，false：不审核
     */
    private boolean goodsCommentFlag;

    /**
     * 商品评论推送用户列表
     */
    private List<String> goodsCommentUserIdList;


    /**
     * 是否是正式环境
     *
     * @return
     */
    public boolean isPro() {
        if (profiles.equals("pro")) {
            return true;
        }
        return false;
    }
}
